
cmake_minimum_required(VERSION 2.6)

project(CROSSENGINE)

set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${CROSSENGINE_BINARY_DIR}/bin)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CROSSENGINE_BINARY_DIR}/bin)


find_package (SDL)
find_package (OpenGL)

include(${CROSSENGINE_SOURCE_DIR}/scripts/FindDirectX9.cmake)
include(${CROSSENGINE_SOURCE_DIR}/scripts/FindXml.cmake)
include(${CROSSENGINE_SOURCE_DIR}/scripts/FindBullet.cmake)

if(WIN32)
  option(CE_USE_OPENGL    "Use OpenGL for renderingsystem" OFF)
  option(CE_USE_DIRECT3D  "Use Direct3D for renderingsystem" ON)
else()
  option(CE_USE_OPENGL    "Use OpenGL for renderingsystem" ON)
endif()

if (CE_USE_OPENGL AND CE_USE_DIRECT3D)
  message ("Specify OpenGL OR Direct3D not both")
endif()

if (NOT CE_USE_OPENGL AND NOT CE_USE_DIRECT3D)
  message ("Specify OpenGL or Direct3D")
endif()

if (CE_USE_DIRECT3D AND NOT DIRECTX9_FOUND)
  message ("Direct3D specified for rendering but not DirectX9 found")
endif()



include_directories (
		${CROSSENGINE_SOURCE_DIR}/sources
		${SDL_INCLUDE_DIR}
		)

message ("******************************************************")
message ("***   Configure Options")
message ("******************************************************")
message ("***")
message ("*** Compile for OpenGL  : " ${CE_USE_OPENGL})
message ("*** Compile for Direct3D: " ${CE_USE_DIRECT3D})
message ("***")
message ("*** SDL found           : " ${SDL_FOUND})
message ("*** OpenGL found        : " ${OPENGL_FOUND})
message ("*** DirectX9 found      : " ${DIRECTX9_FOUND})
message ("*** libXML2 found       : " ${LIBXML2_FOUND})
message ("*** Bullet found        : " ${BULLET_FOUND})
message ("***")
message ("******************************************************")

add_subdirectory (sources)
  #add_subdirectory (apps)
add_subdirectory (samples)
